package com.template.method.demo1;

public abstract class AbstractTemplate {

    private void step1(String key) {
        System.out.println("在父类中执行方法----->> 1 = " + key);
        step2(key);
        if (key.equals("x")) {
            step3(key);
        } else {
            step4(key);
        }
        step5();
    }

    private void step2(String key) {
        System.out.println("在父类中执行方法----->> 2 = " + key);
    }


    public abstract void step3(String key);

    public abstract void step4(String key);

    private void step5() {
        System.out.println("在父类中执行方法----->> 5 = ");
    }

    public void run(String key) {
        step1(key);
    }
}
